package com.bijava.service.impl;

import cn.org.atool.fluent.mybatis.model.IPagedList;
import cn.org.atool.fluent.mybatis.model.StdPagedList;
import com.bijava.entity.SysLog;
import com.bijava.mapper.SysLogMapper;
import com.bijava.model.PageQuery;
import com.bijava.model.vo.SysLogVO;
import com.bijava.service.SysLogService;
import com.bijava.support.impl.AbstractBaseService;
import com.bijava.utils.BeanMapper;
import com.bijava.wrapper.SysLogQuery;
import com.bijava.wrapper.SysLogUpdate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author bishichu
 * @description
 * @since 2021/11/23
 */
@Service
public class SysLogServiceImpl extends AbstractBaseService<SysLog, SysLogVO, SysLogQuery, SysLogUpdate, SysLogMapper> implements SysLogService {

    @Override
    public IPagedList<SysLogVO> selectListByPage(PageQuery<SysLog> pageQuery) {
        SysLogQuery sysLogQuery = SysLogQuery.query()
                .limit(pageQuery.getPageNo(), pageQuery.getPageSize());
        StdPagedList<SysLog> pagedEntity = this.mapper.stdPagedEntity(sysLogQuery);
        List<SysLogVO> sysLogVOS = BeanMapper.mapList(pagedEntity.getData(), SysLog.class, SysLogVO.class);
        return new StdPagedList(pagedEntity.getTotal(),sysLogVOS,pagedEntity.hasNext());
    }
}
